home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.11 Nov 90 / NeuralNet Estimator⁄EDIT / General.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-03  |  1.1 KB  |  60 lines  |  [TEXT/KAHL]

  1. #include "Neural Network.h"
  2. #include <math.h>
  3.  
  4. extern FILE * Jac;
  5.  
  6. extern NeuralNet *    theNet;
  7. extern DTypeVector     yData;
  8. extern DTypeMatrix    XData;
  9. extern DTypeVector     Alpha[];
  10. extern DTypeVector    Pi;
  11. extern DTypeVector    Diag;
  12.  
  13. /*-----------------------
  14.     Restore the weight parameters in vector Pi to W[i] for use in line search algorithm.
  15. */
  16. RestoreParms(vec)
  17.     DTypeVector * vec;
  18. {
  19.     int j,k,N;
  20.     DataType * v;
  21.     DataType * w;
  22.     
  23.     v = *vec->cells;
  24.     for(j=0; j<theNet->OutLayer; j++)
  25.     {    N = (theNet->W[j].rows)*(theNet->W[j].cols);
  26.         w = *theNet->W[j].cells;
  27.         for(k=0; k<N; k++, w++, v++)
  28.             *w = *v;
  29.     }
  30. }    
  31.  
  32. /*-----------------------
  33.     Save the weight parameters in vector Pi for use in line search algorithm.
  34. */
  35. SaveParms(vec)
  36.     DTypeVector * vec;
  37. {
  38.     int j,k,N;
  39.     DataType * v;
  40.     DataType * w;
  41.     
  42.     v = *vec->cells;
  43.     for(j=0; j<theNet->OutLayer; j++)
  44.     {    N = (theNet->W[j].rows)*(theNet->W[j].cols);
  45.         w = *theNet->W[j].cells;
  46.         for(k=0; k<N; k++, w++, v++)
  47.             *v = *w;
  48.     }
  49. }    
  50.  
  51. NotYetAvail()
  52. {
  53.     printf("chosen method not yet available") , ExitToShell();
  54. }
  55.  
  56. HandleOutOfMem()
  57. {
  58.     printf("Out of memory") , ExitToShell();
  59. }
  60.